from pydantic import BaseModel, field_validator
from typing import Optional

class ActivityLimitType(BaseModel):
    type: Optional[int] = None

class ActivityMyList(BaseModel):
    username: Optional[str] = None
    password: Optional[str] = None


class Activity(BaseModel):
    isRecommend: Optional[int] = None
    enrollEndTime: Optional[int] = None
    collegeLimit: Optional[str] = None
    activityStatus: Optional[int] = None
    logo: Optional[str] = None
    startTime: Optional[int] = None
    id: Optional[int] = None
    classifyName: Optional[str] = None
    hours: Optional[float] = None
    genderLimit: Optional[int] = None
    honestLimit: Optional[int] = None
    address: Optional[str] = None
    organizationName: Optional[str] = None
    gradeLimit: Optional[str] = None
    organizationLimit: Optional[str] = None
    activityLimitType: Optional[ActivityLimitType] = None
    organizationStatus: Optional[int] = None
    avatar: Optional[str] = None
    limitType: Optional[int] = None
    isAbleEnroll: Optional[int] = None
    enrollStartTime: Optional[int] = None
    createId: Optional[int] = None
    name: Optional[str] = None
    endTime: Optional[int] = None
    enrollCount: Optional[int] = None
    peopleLimit: Optional[int] = None

    @field_validator('*', mode='before')
    @classmethod
    def empty_str_to_none(cls, v):
        if v == '':
            return None
        return v